package com.etc.controller;

import com.etc.entity.AdContent;
import com.etc.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/adController")
public class adController {

    @Autowired
    AdService adService;

    @RequestMapping("/findAllAd")
    public List<AdContent> findAllAd(){
         return adService.selectAllAd();
    }

    @RequestMapping("/deleteThisAd")
    public boolean deleteThisAd(Long op) {
        boolean flag = adService.deleteThisId(op);
        return flag;
    }

    @RequestMapping(value = "/getAllAd",method = RequestMethod.GET)
    public  List<AdContent> getAllAd(@RequestParam("categoryid3")Long categoryid3){
        //调用业务层的方法
        List<AdContent> list = adService.dofind(categoryid3);
        return list;
    }
}
